package thread2;

public class YieldDemo implements Runnable {
    public static void main(String[] args) {
        YieldDemo demo = new YieldDemo();
        new Thread(demo, "a").start();
        new Thread(demo, "b").start();
    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "开始执行");
        Thread.yield();
        System.out.println(Thread.currentThread().getName() + "停止执行");
    }
}
